package com.bdth.bdthcms.util;

import java.text.DecimalFormat;

/**
 * Created by Administrator on 2018/11/16.
 */
public class StringUtil {
    public static boolean in_array(String[] array, String str){
        if(array==null)
            return false;
        for(int a=0;a<array.length;a++){
            if(array[a].equals(str))
                return true;
        }
        return false;
    }

    public static double getDecimal(String s,String format){
        double d= Double.parseDouble(s);
        DecimalFormat df = new DecimalFormat(format);
        String temp = df.format(d);
        return Double.parseDouble(temp);
    }

    public static double getDecimal(String s){
        return getDecimal(s,"0.00");
    }
}
